cmake_minimum_required(VERSION 3.10)
project(CheckTableMode C)

set(CMAKE_C_STANDARD 11)

# 添加UNICODE定义
add_definitions(-DUNICODE -D_UNICODE)

# Windows子系统设置为窗口应用程序
if(MSVC)
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS")
endif()

add_executable(DeviceModeMonitor 
    DeviceModeMonitor.c
)

# 为Windows设置特定链接选项 - 添加更多必要的库，包括服务相关的库
target_link_libraries(DeviceModeMonitor setupapi user32 gdi32 advapi32 shell32)

# 安装规则
install(TARGETS DeviceModeMonitor DESTINATION .)
install(FILES 
    install_service.bat
    uninstall_service.bat
    README.md
    DESTINATION .)
